const CracoLessPlugin = require("craco-less")
const { getThemeVariables } = require("antd/dist/theme")
const path = require('path')
module.exports = {
  webpack: {
    alias: {
      "@": path.join(__dirname, "src"),
    },
  },
  babel: {
    //按需加载样式
    plugins: [
      [
        "import",
        {
          libraryName: "antd",
          libraryDirectory: "es",
          style: true, //设置为true即是less
        },
      ],
    ],
  },
  //自定义主题
  plugins: [
    {
      plugin: CracoLessPlugin,
      options: {
        lessLoaderOptions: {
          lessOptions: {
            modifyVars: {
              ...getThemeVariables({
                // dark: true, // 开启暗黑模式
                // compact: true, // 开启紧凑模式
              }),
              "@primary-color": "#1DA57A",
            },
            javascriptEnabled: true,
          },
        },
      },
    },
  ],
}
